package com.train.daily.api;

import com.train.common.constants.ApiConstants;
import com.train.common.resp.CommonResp;
import com.train.daily.api.fallback.DailyTrainTicketApiFallback;
import com.train.daily.dto.ticket.DailyTrainTicketQueryOneDTO;
import com.train.daily.dto.ticket.DailyTrainTicketReduceTicketDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(
        contextId = "dailyTrainTicketApi",
        name = ApiConstants.DAILY_TRAIN_NAME,
        path = ApiConstants.DAILY_TRAIN_PREFIX,
        fallback = DailyTrainTicketApiFallback.class)
public interface DailyTrainTicketApi {

    String PREFIX =  "/ticket";

    @PostMapping(PREFIX + "/one")
    CommonResp getDailyTrainTicket(@RequestBody DailyTrainTicketQueryOneDTO dto);

    @PostMapping(PREFIX + "/reduce/ticket")
    CommonResp batchReduceDailyTrainTicket(@RequestBody List<DailyTrainTicketReduceTicketDTO> dtoList);
}
